<template>
  <div class="empty-data" :style="{height:height}" @click="onClick">
    <div :class="['inner',size?'inner-'+size:'']">
      <span class="inner-icon" v-if="showIcon"></span>
      <div class="fc9">{{placeholder}}</div>
    </div>
  </div>
</template>
<script>
export default {
  name: 'EmptyData',
  props: {
    size: {
      type: String,
      default: 'small'
    },
    height: {
      type: String,
      default: '400px'
    },
    placeholder: {
      type: String,
      default: '暂无数据'
    },
    showIcon: {
      type: Boolean,
      default: true
    }
  },
  data () {
    return {}
  },
  methods: {
    onClick () {
      this.$emit('click')
    }
  }
}
</script>
<style lang="scss" scoped>
@import "~@/styles/variables.scss";
.empty-data {
  height: 100%;
  position: relative;
  min-height: rem(180px);
  .inner {
    text-align: center;
    position: absolute;
    left: 50%;
    top: 50%;
    width: rem(140px);
    font-size: rem(16px);
    color: #666;
    &-small {
      width: rem(100px);
      font-size: rem(14px);
    }
    &-mini {
      width: rem(60px);
      font-size: rem(12px);
    }
    transform: translate(-50%, -50%);
    &-icon {
      display: inline-block;
      padding: 45% 0;
      width: 100%;
      background: url("~@/assets/empty-icon.png") no-repeat center;
      background-size: contain;
    }
  }
}
</style>
